package com.google.coffeeshop.gui.desktop.orderpayment;

import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

import com.google.coffeeshop.entity.SeatDTO;
import com.google.coffeeshop.gui.desktop.AbstractBaseFrame;
import com.google.coffeeshop.gui.desktop.message.CaptionMessages;

public class StopSeatActionsFrame extends AbstractBaseFrame {
	private static final long serialVersionUID = 1L;
	
	private SeatBoardPanel parent;
	private SeatDTO seat;
	
	public StopSeatActionsFrame(SeatBoardPanel parent, SeatDTO seat) {
		super(CaptionMessages.STOP_SEAT_ACTIONS_TITLE);
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		this.seat = seat;
		this.parent = parent;
		setSize(320, 110);
		addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				disposeFrame();
				refreshParentGUI();
			}
		});
		StopSeatActionsPanel pnlStopSeatActions = new StopSeatActionsPanel(this, seat);
		getContentPane().add(pnlStopSeatActions, BorderLayout.NORTH);
		
	}
	
	public void disposeFrame() {
		this.dispose();
	}
	
	public void refreshParentGUI() {
		parent.refreshGuiAndParent();
	}
	
}
